[PATCH] net_sched: cls_route: remove from list when handle is 0
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Tue, 2 Aug 2022 08:52:56 +0000 (05:52 -0300)
committerSalvatore Bonaccorso <carnil@debian.org>
Sat, 13 Aug 2022 13:25:10 +0000 (14:25 +0100)
commit9fe3173e74116f79f7991d1295ee195c5cbe72da
tree152cfa5b428f2ccd34bbfecb22d4aad2c258f23c
parent1fad26ae01aca2af73fdcfed3c6875d04c35e83c
[PATCH] net_sched: cls_route: remove from list when handle is 0

When a route filter is replaced and the old filter has a 0 handle, the old
one won't be removed from the hashtable, while it will still be freed.

The test was there since before commit 1109c00547fc ("net: sched: RCU
cls_route"), when a new filter was not allocated when there was an old one.
The old filter was reused and the reinserting would only be necessary if an
old filter was replaced. That was still wrong for the same case where the
old handle was 0.

Remove the old filter from the list independently from its handle value.

This fixes CVE-2022-2588, also reported as ZDI-CAN-17440.

Reported-by: Zhenpeng Lin <zplin@u.northwestern.edu>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Reviewed-by: Kamal Mostafa <kamal@canonical.com>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name net_sched-cls_route-remove-from-list-when-handle-is-.patch
net/sched/cls_route.c